import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:lyf_shop/views/temp/detail_page.dart';

class CounterController extends GetxController {
  var counter = 99.obs;
  increment() {
    counter ++ ;
  }

  decrement(){
    counter --;
  }
}


class LYFTestDemo extends StatelessWidget {
  const LYFTestDemo({super.key});

  @override
  Widget build(BuildContext context) {

    final CounterController c = Get.put(CounterController());

    return Scaffold(
      appBar: AppBar(
        title: Text("测试"),
      ),
      body: Container(
        child: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Obx(()=>Text("当前计数: ${c.counter}")),
              InkWell(
                onTap: (){
                    c.increment();
                },
                child: Container(
                  // width: 200,
                  // height: 40,
                  decoration: BoxDecoration(),
                  child: Text("点击+1"),
                ),

              ),
              InkWell(
                onTap: (){
                  Get.to(DetailPage());
                },
                child: Container(
                  child: Text("进入详情"),
                ),
              )
            ],
          ),

        ),
      ),
    );
  }
}
